home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Today - The Disc! 5
/
CD-ROM Today - The Disc (Issue 5)(November 1994).ISO
/
mac
/
Mac shareware
/
Education
/
RLaB
/
rlib
/
num2str.r
< prev
next >
Wrap
Text File
|
1994-09-21
|
681b
|
33 lines
//-------------------------------------------------------------------//
// Synopsis: Convert a number object into a string-object.
// Syntax: num2str ( N )
// Description:
// Num2str converts the real-numeric argument into a string, which
// is the return value.
//-------------------------------------------------------------------//
num2str = function ( N )
{
local (i, j, s, stmp)
if (class (N) == "num" && type (N) == "real")
{
s = [];
for (i in 1:N.nr)
{
for (j in 1:N.nc)
{
sprintf (stmp, "%.4g", N[i;j]);
s[i;j] = stmp;
}
}
return s;
else
error ("num2str: argument must be numeric-real");
}
};